/*
 * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
 *
 * https://www.mall4j.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */
package com.yami.shop.distribution.api.controller;

import com.yami.shop.common.config.Constant;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.distribution.common.vo.DistributionConfigVO;
import com.yami.shop.service.SysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lgh on 2019/04/01.
 */
@RestController
@RequestMapping("/p/distribution/distributionBasicSet")
@Api(tags = "分销基本设置")
public class DistributionBasicController {

    @Autowired
    private SysConfigService sysConfigService;

    @GetMapping("/canDistribution")
    @ApiOperation(value = "分销开关是否开启", notes = "获取分销开关是否开启，0关闭 1开启")
    public ServerResponseEntity<Integer> info(){
        DistributionConfigVO distributionConfigVO = sysConfigService.getSysConfigObject(Constant.DISTRIBUTION_CONFIG, DistributionConfigVO.class);
        return ServerResponseEntity.success(distributionConfigVO.getDistributionSwitch());
    }
}
